package com.liruo.treasureattic.service.url.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.liruo.treasureattic.common.model.dto.url.UrlFolderAddReq;
import com.liruo.treasureattic.common.model.dto.url.UrlFolderUpdateReq;
import com.liruo.treasureattic.common.model.entity.UrlFolder;
import com.liruo.treasureattic.common.model.other.Pair;
import com.liruo.treasureattic.common.model.vo.url.UrlFolderVo;

import java.util.List;
import java.util.Set;

/**
* @author LYM
* @description 针对表【url_folder】的数据库操作Service
* @createDate 2022-10-31 20:29:39
*/
public interface UrlFolderService extends IService<UrlFolder> {
    /**
     * fid == null name只检测长度
     */
    long addDefaultFolder(UrlFolderAddReq folderAddReq);
    /**
     * fid != null name只检测长度
     */
    long addFolder(UrlFolderAddReq folderAddReq);

    /**
     * old和Update一样就不更新直接返回
     */
    void updateFolder(UrlFolderUpdateReq urlFolderUpdateReq);

    List<UrlFolderVo> getAllFolder();




    //   非Controller方法
    void folderExistAndNotDefault(Set<Long> ids);

    /**
     * @return  子folder
     */
    List<UrlFolder> getSubFolder(long fid, boolean open, long uid);
    /**
     * @return  默认folder
     */
    UrlFolder getDefaultFolder(long uid);
    /**
     * @return  folder的fid
     */
    long getDefaultFolderId(long uid);

    /**
     * 连同url和子folder一起删除
     */
    Pair<Integer, Integer> realDeleteUrlFolder(int delValCycleDays);


    //batch 操作

    /**
     * 不与旧数据对比
     */
    void batchUpdateFolder(List<UrlFolderUpdateReq> batchUpdateFolderList);

}
